<%@ page import="com.zafu.dao.MessageBean" %>
<%@ page import="com.zafu.entity.MessageInfo" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2024/12/25
  Time: 8:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    MessageBean bean = new MessageBean();
    ArrayList<MessageInfo> data = bean.GetAll();
    StringBuilder builder = new StringBuilder();
    out.println("<Messages>");
    Iterator<MessageInfo> iter = data.iterator();
    while (iter.hasNext()) {
        MessageInfo info = iter.next();
        builder.append(info.toString()).append("\n");

        out.println("<Message>");
        out.println("<name>" + info.getMessage_Name() + "</name>");
        out.println("<image>" + info.getMessage_Image() + "</image>");
        out.println("<message>" + info.getMessage() + "</message>");
        out.println("<date>" + info.getMessage_Date() + "</date>");
        out.println("<id>" + info.getId() + "</id>");
        out.println("</Message>");
    }
    out.println("</Messages>");
    System.out.printf(builder.toString());
%>